using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;

namespace FU.Capstones.IMS.Web.Common.InventoryServiceProxy.DataContracts
{
    [KnownType(typeof(NewPasswordData))]
    [DataContract(Namespace = WebConstants.ServiceNamespace)]
    public class Account : BindingModelBase<Account>
    {
        public Account()
        {
            AddAllAttributeValidators();
        }

        private string fullName;
        [DataMember]
        public string FullName
        {
            get { return fullName; }
            set
            {
                if(!ReferenceEquals(fullName, value))
                {
                    fullName = value;
                    RaisePropertyChanged(()=>FullName);
                }
            }
        }

        private string username;
        [DataMember]
        [Required(AllowEmptyStrings = false, ErrorMessage = "Tên đang nhập không được bỏ trống!")]
        [Display(Name = "Tên đăng nhập")]
        public string Username
        {
            get { return username; }
            set
            {
                if(!ReferenceEquals(username, value))
                {
                    username = value;
                    RaisePropertyChanged(() => Username);
                }
            }
        }

        private string password;
        [DataMember]
        [Required(AllowEmptyStrings = false, ErrorMessage = "Mật khẩu không được bỏ trống!")]
        [Display(Name = "Mật khẩu")]
        public string Password
        {
            get { return password; }
            set
            {
                if (!ReferenceEquals(password, value))
                {
                    password = value;
                    RaisePropertyChanged(() => Password);
                }
            }
        }

        private int employeeID;
        [Key]
        [DataMember]
        public int EmployeeID
        {
            get { return employeeID; }
            set
            {
                if(employeeID != value)
                {
                    employeeID = value;
                    RaisePropertyChanged(() => EmployeeID);
                }
            }
        }

        #region OrderMaterial rights

        private bool canViewOrderMaterial;
        [DataMember]
        public bool CanViewOrderMaterial
        {
            get { return canViewOrderMaterial; }
            set
            {
                if (canViewOrderMaterial != value)
                {
                    canViewOrderMaterial = value;
                    RaisePropertyChanged(() => CanViewOrderMaterial);
                }
            }
        }

        private bool canEditOrderMaterial;
        [DataMember]
        public bool CanEditOrderMaterial
        {
            get { return canEditOrderMaterial; }
            set
            {
                if (canEditOrderMaterial != value)
                {
                    canEditOrderMaterial = value;
                    RaisePropertyChanged(() => CanEditOrderMaterial);
                }
            }
        }

        private bool canAddOrderMaterial;
        [DataMember]
        public bool CanAddOrderMaterial
        {
            get { return canAddOrderMaterial; }
            set
            {
                if (canAddOrderMaterial != value)
                {
                    canAddOrderMaterial = value;
                    RaisePropertyChanged(() => CanEditOrderMaterial);
                }
            }
        }

        #endregion

        #region OrderProduct rights

        private bool canViewOrderProduct;
        [DataMember]
        public bool CanViewOrderProduct
        {
            get { return canViewOrderProduct; }
            set
            {
                if (canViewOrderProduct != value)
                {
                    canViewOrderProduct = value;
                    RaisePropertyChanged(() => CanViewOrderProduct);
                }
            }
        }

        private bool canEditOrderProduct;
        [DataMember]
        public bool CanEditOrderProduct
        {
            get { return canEditOrderProduct; }
            set
            {
                if (canEditOrderProduct != value)
                {
                    canEditOrderProduct = value;
                    RaisePropertyChanged(() => CanEditOrderProduct);
                }
            }
        }

        private bool canAddOrderProduct;
        [DataMember]
        public bool CanAddOrderProduct
        {
            get { return canAddOrderProduct; }
            set
            {
                if (canAddOrderProduct != value)
                {
                    canAddOrderProduct = value;
                    RaisePropertyChanged(() => CanEditOrderProduct);
                }
            }
        }

        #endregion
        
        #region Employee rights

        private bool canViewEmployee;
        [DataMember]
        public bool CanViewEmployee
        {
            get { return canViewEmployee; }
            set
            {
                if (canViewEmployee != value)
                {
                    canViewEmployee = value;
                    RaisePropertyChanged(() => CanViewEmployee);
                }
            }
        }

        private bool canEditEmployee;
        [DataMember]
        public bool CanEditEmployee
        {
            get { return canEditEmployee; }
            set
            {
                if (canEditEmployee != value)
                {
                    canEditEmployee = value;
                    RaisePropertyChanged(() => CanEditEmployee);
                }
            }
        }

        private bool canAddEmployee;
        [DataMember]
        public bool CanAddEmployee
        {
            get { return canAddEmployee; }
            set
            {
                if (canAddEmployee != value)
                {
                    canAddEmployee = value;
                    RaisePropertyChanged(() => CanEditEmployee);
                }
            }
        }

        #endregion
        
        #region EmploymentType rights

        private bool canViewEmploymentType;
        [DataMember]
        public bool CanViewEmploymentType
        {
            get { return canViewEmploymentType; }
            set
            {
                if (canViewEmploymentType != value)
                {
                    canViewEmploymentType = value;
                    RaisePropertyChanged(() => CanViewEmploymentType);
                }
            }
        }

        private bool canEditEmploymentType;
        [DataMember]
        public bool CanEditEmploymentType
        {
            get { return canEditEmploymentType; }
            set
            {
                if (canEditEmploymentType != value)
                {
                    canEditEmploymentType = value;
                    RaisePropertyChanged(() => CanEditEmploymentType);
                }
            }
        }

        private bool canAddEmploymentType;
        [DataMember]
        public bool CanAddEmploymentType
        {
            get { return canAddEmploymentType; }
            set
            {
                if (canAddEmploymentType != value)
                {
                    canAddEmploymentType = value;
                    RaisePropertyChanged(() => CanEditEmploymentType);
                }
            }
        }

        #endregion
        
        #region Role rights

        private bool canViewRole;
        [DataMember]
        public bool CanViewRole
        {
            get { return canViewRole; }
            set
            {
                if (canViewRole != value)
                {
                    canViewRole = value;
                    RaisePropertyChanged(() => CanViewRole);
                }
            }
        }

        private bool canEditRole;
        [DataMember]
        public bool CanEditRole
        {
            get { return canEditRole; }
            set
            {
                if (canEditRole != value)
                {
                    canEditRole = value;
                    RaisePropertyChanged(() => CanEditRole);
                }
            }
        }

        private bool canAddRole;
        [DataMember]
        public bool CanAddRole
        {
            get { return canAddRole; }
            set
            {
                if (canAddRole != value)
                {
                    canAddRole = value;
                    RaisePropertyChanged(() => CanEditRole);
                }
            }
        }

        #endregion
        
        #region Partner rights

        private bool canViewPartner;
        [DataMember]
        public bool CanViewPartner
        {
            get { return canViewPartner; }
            set
            {
                if (canViewPartner != value)
                {
                    canViewPartner = value;
                    RaisePropertyChanged(() => CanViewPartner);
                }
            }
        }

        private bool canEditPartner;
        [DataMember]
        public bool CanEditPartner
        {
            get { return canEditPartner; }
            set
            {
                if (canEditPartner != value)
                {
                    canEditPartner = value;
                    RaisePropertyChanged(() => CanEditPartner);
                }
            }
        }

        private bool canAddPartner;
        [DataMember]
        public bool CanAddPartner
        {
            get { return canAddPartner; }
            set
            {
                if (canAddPartner != value)
                {
                    canAddPartner = value;
                    RaisePropertyChanged(() => CanEditPartner);
                }
            }
        }

        #endregion
        
        #region Warehouse rights

        private bool canViewWarehouse;
        [DataMember]
        public bool CanViewWarehouse
        {
            get { return canViewWarehouse; }
            set
            {
                if (canViewWarehouse != value)
                {
                    canViewWarehouse = value;
                    RaisePropertyChanged(() => CanViewWarehouse);
                }
            }
        }

        private bool canEditWarehouse;
        [DataMember]
        public bool CanEditWarehouse
        {
            get { return canEditWarehouse; }
            set
            {
                if (canEditWarehouse != value)
                {
                    canEditWarehouse = value;
                    RaisePropertyChanged(() => CanEditWarehouse);
                }
            }
        }

        private bool canAddWarehouse;
        [DataMember]
        public bool CanAddWarehouse
        {
            get { return canAddWarehouse; }
            set
            {
                if (canAddWarehouse != value)
                {
                    canAddWarehouse = value;
                    RaisePropertyChanged(() => CanEditWarehouse);
                }
            }
        }

        #endregion
        
        #region Product rights

        private bool canViewProduct;
        [DataMember]
        public bool CanViewProduct
        {
            get { return canViewProduct; }
            set
            {
                if (canViewProduct != value)
                {
                    canViewProduct = value;
                    RaisePropertyChanged(() => CanViewProduct);
                }
            }
        }

        private bool canEditProduct;
        [DataMember]
        public bool CanEditProduct
        {
            get { return canEditProduct; }
            set
            {
                if (canEditProduct != value)
                {
                    canEditProduct = value;
                    RaisePropertyChanged(() => CanEditProduct);
                }
            }
        }

        private bool canAddProduct;
        [DataMember]
        public bool CanAddProduct
        {
            get { return canAddProduct; }
            set
            {
                if (canAddProduct != value)
                {
                    canAddProduct = value;
                    RaisePropertyChanged(() => CanEditProduct);
                }
            }
        }

        #endregion

        #region Material rights

        private bool canViewMaterial;
        [DataMember]
        public bool CanViewMaterial
        {
            get { return canViewMaterial; }
            set
            {
                if (canViewMaterial != value)
                {
                    canViewMaterial = value;
                    RaisePropertyChanged(() => CanViewMaterial);
                }
            }
        }

        private bool canEditMaterial;
        [DataMember]
        public bool CanEditMaterial
        {
            get { return canEditMaterial; }
            set
            {
                if (canEditMaterial != value)
                {
                    canEditMaterial = value;
                    RaisePropertyChanged(() => CanEditMaterial);
                }
            }
        }

        private bool canAddMaterial;
        [DataMember]
        public bool CanAddMaterial
        {
            get { return canAddMaterial; }
            set
            {
                if (canAddMaterial != value)
                {
                    canAddMaterial = value;
                    RaisePropertyChanged(() => CanEditMaterial);
                }
            }
        }

        #endregion

    }
}